package com.demo.controller;

import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.demo.dao.CourseDAO;
import com.demo.entity.Course;

@RestController
@RequestMapping(value = "/course")
public class CourseController {

	@Resource
	CourseDAO adminCourseDAO;

	/**
	 * 根据课程编号查单个课程
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/{id}")
	public Course findById(@PathVariable("id") Long id) {
		
		
		
		Course course = adminCourseDAO.findById(id).get();
		//course.getCourseSections();
		
		
		return course;
	}

}